"use strict";

/**
 * @auther wtfssd
 * Created by wtfssd on 2017/12/25
 */
import * as React from 'react'
import {autoSize, commonStyles} from "../assets/styles/common";
import Colors from "../assets/styles/Colors";
import Avatar from "./Avatar";
import MyText from "./MyText";
import {ContactUserProps} from "./index";
import Request from "../utils/Request";

const {View, Text} = require('react-native');
const {connect} = require('react-redux');



/**
 * 当前正在聊天的人
 */
class ContactUser extends React.Component<ContactUserProps, any> {
    render() {
        let info = '';
        if (this.props.user.duty) {
            info += this.props.user.duty + 'at ';
        }
        if (this.props.user.company) {
            info += this.props.user.company.name;
        }
        return (
            <View style={[ commonStyles.flexRow, {padding: autoSize(15), alignItems: 'center',height:autoSize(95),
                backgroundColor:Colors.Background
            }]}>
                <Avatar size={autoSize(65)} source={{uri:Request.checkImageUrl(this.props.user.avatar)}}/>
                <View style={[commonStyles.flexColumn,{justifyContent: 'space-around', marginLeft: 15}]}>
                    <MyText color={Colors.Title} fontSize={15}>{this.props.user.nickName}</MyText>
                    <MyText color={Colors.Title} fontSize={12}>{info}</MyText>
                    {/*<MyText color={Colors.SubTitle} fontSize={12}>{this.props.user.avatar}</MyText>*/}
                </View>
            </View>
        );
    }
}


export default ContactUser;